﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Globalization;

public partial class ResumeSearchByExperience : System.Web.UI.Page
{
    string minexp = "";
    string maxexp = "";
    string mode = "ByExperience";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Fillddls();
        }
    }

    protected void btnSeachBySkills_Click(object sender, EventArgs e)
    {
        mode = clsEncryptionDecryption.EncryptQueryString(mode);
        minexp = clsEncryptionDecryption.EncryptQueryString(minexp);
        maxexp = clsEncryptionDecryption.EncryptQueryString(maxexp);
        Response.Redirect("ResumeSearchResult.aspx?mode=" + mode + "&minexp=" + clsEncryptionDecryption.EncryptQueryString(ddlMinExpRequired.SelectedValue) + "&maxexp=" + clsEncryptionDecryption.EncryptQueryString(ddlMaxExpRequired.SelectedValue));
    }

    protected void Fillddls()
    {
        try
        {
            //Min Experience Required
            ddlMinExpRequired.Items.Clear();
            ddlMinExpRequired.AppendDataBoundItems = true;
            ddlMinExpRequired.Items.Add("Select");
            ddlMinExpRequired.Items[0].Value = "0";
            for (int i = 1; i <= 90; i++)
            {
                ddlMinExpRequired.Items.Add(i.ToString());
                ddlMinExpRequired.Items[i].Value = i.ToString();
            }
            ddlMinExpRequired.DataBind();

            // Max Experience Required
            ddlMaxExpRequired.Items.Clear();
            ddlMaxExpRequired.AppendDataBoundItems = true;
            ddlMaxExpRequired.Items.Add("Select");
            ddlMaxExpRequired.Items[0].Value = "0";
            for (int i = 1; i <= 90; i++)
            {
                ddlMaxExpRequired.Items.Add(i.ToString());
                ddlMaxExpRequired.Items[i].Value = i.ToString();
            }
            ddlMaxExpRequired.DataBind();
        }
        catch (Exception)
        {

            throw;
        }
    }

    protected void btnClearSearch_Click(object sender, EventArgs e)
    {
        try
        {
            ddlMinExpRequired.SelectedIndex = 0;
            ddlMaxExpRequired.SelectedIndex = 0;
        }
        catch (Exception)
        {

            throw;
        }
    }
    //protected void grdSeachBySkills_RowDataBound(object sender, GridViewRowEventArgs e)
    //{
    //    try
    //    {
    //        if (e.Row.RowType == DataControlRowType.DataRow)
    //        {
    //            //Getting Job Location
    //            int Job_locationId = Convert.ToInt32(e.Row.Cells[8].Text);
    //            clsCity objclsCity = new clsCity();
    //            IN_TB_CITY objIN_TB_CITY = new IN_TB_CITY();
    //            objIN_TB_CITY = objclsCity.GetCityById(Job_locationId);
    //            e.Row.Cells[8].Text = objIN_TB_CITY.CITY;

    //            //Getting Preferred Location
    //            int Preferred_locationId = Convert.ToInt32(e.Row.Cells[11].Text);
    //            objclsCity = new clsCity();
    //            objIN_TB_CITY = new IN_TB_CITY();
    //            objIN_TB_CITY = objclsCity.GetCityById(Preferred_locationId);
    //            e.Row.Cells[11].Text = objIN_TB_CITY.CITY;

    //            // Geting Functional Area
    //            int Functional_AreaId = Convert.ToInt32(e.Row.Cells[10].Text);
    //            clsFunctionalAreaDAL objclsFunctionalAreaDAL = new clsFunctionalAreaDAL();
    //            IN_TB_FUNCTIONAL_AREA objIN_TB_FUNCTIONAL_AREA = new IN_TB_FUNCTIONAL_AREA();
    //            objIN_TB_FUNCTIONAL_AREA = objclsFunctionalAreaDAL.GetAllFunctionalAreaById(Functional_AreaId);
    //            e.Row.Cells[10].Text = objIN_TB_FUNCTIONAL_AREA.FUNCTIONAL_AREA;

    //            ImageButton lnkDownloadCV = (ImageButton)e.Row.FindControl("lnkDownloadCV");
    //            Label lblDownload = (Label)e.Row.FindControl("lblDownload");
    //            clsEmployerDAL objclsEmployerDAL = new clsEmployerDAL();

    //            if (Session["EmployerId"] != null)
    //            {
    //                IN_TB_EMPLOYER_MST objIN_TB_EMPLOYER_MST = new IN_TB_EMPLOYER_MST();
    //                objIN_TB_EMPLOYER_MST = objclsEmployerDAL.GetEmployerById(Convert.ToInt32(Session["EmployerId"].ToString()));
    //                if (objIN_TB_EMPLOYER_MST != null)
    //                {
    //                    DateTime DownloadTill = Convert.ToDateTime(objIN_TB_EMPLOYER_MST.DOWNLOAD_TILL);
    //                    if (DownloadTill.Date < DateTime.Today.Date)
    //                    {
    //                        lnkDownloadCV.Enabled = false;
    //                        lblDownload.Text = "Download Limit Exceeded";
    //                    }
    //                    else
    //                    {
    //                        lblDownload.Text = "";
    //                    }
    //                }
    //            }

    //        }
    //    }
    //    catch (Exception)
    //    {

    //        throw;
    //    }
    //}
    //protected void grdSeachBySkills_RowCommand(object sender, GridViewCommandEventArgs e)
    //{
    //    if (e.CommandName == "ViewCV")
    //    {
    //        if (Session["UserId"] != null)
    //        {
    //            string UserId = Convert.ToString(e.CommandArgument);
    //            clsSearchResume objclsSearchResume = new clsSearchResume();
    //            clsResumeSearchResultBo objclsResumeSearchResultBo = new clsResumeSearchResultBo();
    //            objclsResumeSearchResultBo = objclsSearchResume.GetResumeByUserId(Convert.ToInt32(UserId));

    //            if (objclsResumeSearchResultBo != null)
    //            {
    //                redirectlink = "ResumeDetails.aspx?userid=" + Convert.ToString(e.CommandArgument);
    //                string skillset = Convert.ToString(objclsResumeSearchResultBo.SKILL_SET);
    //                if (skillset != "" && skillset != null)
    //                {
    //                    skillset = clsEncryptionDecryption.EncryptQueryString(skillset);
    //                    redirectlink += "&skillset=" + skillset;
    //                }
    //                string email = Convert.ToString(objclsResumeSearchResultBo.EMAIL);
    //                if (email != "" && email != null)
    //                {
    //                    email = clsEncryptionDecryption.EncryptQueryString(email);
    //                    redirectlink += "&email=" + email;
    //                }
    //                string mobile = Convert.ToString(objclsResumeSearchResultBo.MOBILE);
    //                if (mobile != "" && mobile != null)
    //                {
    //                    mobile = clsEncryptionDecryption.EncryptQueryString(mobile);
    //                    redirectlink += "&mobile=" + mobile;
    //                }
    //                string phone = Convert.ToString(objclsResumeSearchResultBo.PHONE);
    //                if (phone != "" && phone != null)
    //                {
    //                    phone = clsEncryptionDecryption.EncryptQueryString(phone);
    //                    redirectlink += "&phone=" + phone;
    //                }
    //                string experience = Convert.ToString(objclsResumeSearchResultBo.EXPERIENCE);
    //                if (experience != "" && experience != null)
    //                {
    //                    experience = clsEncryptionDecryption.EncryptQueryString(experience);
    //                    redirectlink += "&experience=" + experience;
    //                }
    //                string currentcomp = Convert.ToString(objclsResumeSearchResultBo.CURRENT_COMPANY);
    //                if (currentcomp != "" && currentcomp != null)
    //                {
    //                    currentcomp = clsEncryptionDecryption.EncryptQueryString(currentcomp);
    //                    redirectlink += "&currentcomp=" + currentcomp;
    //                }
    //                string currentdesig = Convert.ToString(objclsResumeSearchResultBo.CURRENT_POST);
    //                if (currentdesig != "" && currentdesig != null)
    //                {
    //                    currentdesig = clsEncryptionDecryption.EncryptQueryString(currentdesig);
    //                    redirectlink += "&currentdesig=" + currentdesig;
    //                }
    //                string currentloc = Convert.ToString(objclsResumeSearchResultBo.CURRENT_LOCATION);
    //                if (currentloc != "" && currentloc != null)
    //                {
    //                    currentloc = clsEncryptionDecryption.EncryptQueryString(currentloc);
    //                    redirectlink += "&currentloc=" + currentloc;
    //                }
    //                string currentctc = Convert.ToString(objclsResumeSearchResultBo.CURRENT_CTC);
    //                if (currentctc != "" && currentctc != null)
    //                {
    //                    currentctc = clsEncryptionDecryption.EncryptQueryString(currentctc);
    //                    redirectlink += "&currentloc=" + currentloc;
    //                }
    //                string functionalarea = Convert.ToString(objclsResumeSearchResultBo.FUNCTIONAL_AREA);
    //                if (functionalarea != "" && functionalarea != null)
    //                {
    //                    functionalarea = clsEncryptionDecryption.EncryptQueryString(functionalarea);
    //                    redirectlink += "&functionalarea=" + functionalarea;
    //                }
    //                string preferredlocation = Convert.ToString(objclsResumeSearchResultBo.PREFERRED_LOCATION);
    //                if (preferredlocation != "" && preferredlocation != null)
    //                {
    //                    preferredlocation = clsEncryptionDecryption.EncryptQueryString(preferredlocation);
    //                    redirectlink += "&preferredlocation=" + preferredlocation;
    //                }
    //                string cvpath = Convert.ToString(objclsResumeSearchResultBo.CV_PATH);
    //                if (cvpath != "" && cvpath != null)
    //                {
    //                    cvpath = clsEncryptionDecryption.EncryptQueryString(cvpath);
    //                    redirectlink += "&cvpath=" + cvpath;
    //                }
    //                string downloadtill = Convert.ToString(objclsResumeSearchResultBo.DOWNLOAD_TILL);
    //                if (downloadtill != "" && downloadtill != null)
    //                {
    //                    downloadtill = clsEncryptionDecryption.EncryptQueryString(downloadtill);
    //                    redirectlink += "&downloadtill=" + downloadtill;
    //                }
    //                Response.Redirect(redirectlink);
    //            }
    //        }
    //        else
    //        {
    //            Response.Redirect("EmployerLogin.aspx");
    //        }
    //    }
    //}
}